/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dsigner.net.common;

import java.io.IOException;
import java.net.InetAddress;

/**
 *
 * @author Technik
 */
public class Pinger {

    public Pinger() {
    }

    public boolean ping(String addr) {
        boolean isr = false;
        try {
            InetAddress adr = InetAddress.getByName(addr);
            if (adr.isReachable(5000)) {
                isr = true;
            }
            //System.out.println("Host 10.136.137.202 is reachable: "+adr.isReachable(5000));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return isr;
    }
    
    public boolean multiplePing(String addr, int count) {
        boolean isr = false;
        try {
            InetAddress adr = InetAddress.getByName(addr);
            if (adr.isReachable(5000)) {
                isr = true;
            }
            //System.out.println("Host 10.136.137.202 is reachable: "+adr.isReachable(5000));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return isr;
    }
    
    public boolean stealthPing(String addr) {
        boolean isr = false;
        try {
            InetAddress adr = InetAddress.getByName(addr);
            if (adr.isReachable(5000)) {
                isr = true;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return isr;
    }
}
